{extend name="base"/}
{block name="body"}

<section class="vbox">
    <section class="scrollable padder">
        <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
            <li>
                <a href="index.html">
                    <i class="fa fa-home">
                    </i>
                    Home
                </a>
            </li>
            <li>
                <a href="#">
                    UI kit
                </a>
            </li>
            <li>
                <a href="#">
                    Form
                </a>
            </li>
            <li class="active">
               {$title??''}
            </li>
        </ul>
        
       
        <section class="panel panel-default">
            <header class="panel-heading font-bold">
                Form elements
            </header>
            <div class="panel-body">
                 <form class="form-horizontal m-t target-form" id="signupForm" method="post">
                    <?php if ( $groups ) { ?>
                                {include file="my/_group"}
                            <?php } else { ?>
                                {volist name="keyList" id="field"}
                                    {include file="my/_inline"}
                                {/volist}
                    <?php } ?>
                  
                    <div class="form-group">
                        <div class="col-sm-4 col-sm-offset-2">
                            <button type="submit" class="btn btn-primary ajax-post" target-form='target-form'>
                                提交
                            </button>
                            <button type="submit" class="btn btn-default" onClick="javascript: history.go(-1);">
                                返回
                            </button>
                         </div>
                    </div>
                </form>
            </div>
        </section>
    </section>
</section>
<a href="#" class="hide nav-off-screen-block" data-toggle="class:nav-off-screen"
data-target="#nav">
</a>

{if condition="isset($importDatetimePicker)"}
        <link href="__JS__/plugins/datetimepicker/datetimepicker.css" rel="stylesheet" type="text/css">
        <script type="text/javascript" src="__JS__/plugins/datetimepicker/datetimepicker.min.js"></script>

        <script>
            $('.form-datetime').datetimepicker({
                language: "zh-CN",
                autoclose: true,
                format: 'yyyy-mm-dd hh:ii'
            });
            $('.form-date').datetimepicker({
                language: "zh-CN",
                minView: 2,
                autoclose: true,
                format: 'yyyy-mm-dd'
            });
            $('.form-time').datetimepicker({
                language: "zh-CN",
                minView: 0,
                startView:1,
                autoclose: true,
                format: 'hh:ii'
            });
            $('.time').change(function () {
                var fieldName = $(this).attr('data-field-name');
                var dateString = $(this).val();
                var date = new Date(dateString);
                var timestamp = date.getTime();
                $('[name=' + fieldName + ']').val(Math.floor(timestamp / 1000));
            });
        </script>
{/if}

{if condition="isset($importCheckBox)"}
        <script>
            $(function () {
                function implode(x, list) {
                    var result = "";
                    for (var i = 0; i < list.length; i++) {
                        if (result == "") {
                            result += list[i];
                        } else {
                            result += ',' + list[i];
                        }
                    }
                    return result;
                }

                $('.oneplus-checkbox').change(function (e) {
                    var fieldName = $(this).attr('data-field-name');
                    var checked = $('.oneplus-checkbox[data-field-name=' + fieldName + ']:checked');
                    var result = [];
                    for (var i = 0; i < checked.length; i++) {
                        var checkbox = $(checked.get(i));
                        result.push(checkbox.attr('value'));
                    }
                    result = implode(',', result);
                    $('.oneplus-checkbox-hidden[data-field-name=' + fieldName + ']').val(result);
                });
            })
        </script>
{/if}

{/block}
